#ifndef CORE
#define CORE

#include "typedef.hpp"

class CalcCore
{
private:
	MessageBus *bus;
	std::array<pairs<uint64_t>, 32> *iregs;
	std::array<float, 32> *fregs;
	std::array<double, 32> *dregs;
	struct Ins
	{
		uint8_t op, op2;
		uint8_t rd, rs1, rs2, type;
		int32_t imm;
	} IR;
	const uint8_t ISA = 0x07;

public:
	CalcCore() :bus(nullptr),iregs(nullptr),fregs(nullptr),dregs(nullptr), IR({ 0,0,0,0,0 }) {};
	CalcCore(MessageBus *);
	~CalcCore() = default;
	CalcCore &operator=(const CalcCore &);
	// 分类型的指令
	void exeI();
	void exeF();
	void exeM();
	// 指令流水线
	void fetch();
	void decode();
	void execute();
	void memory();
	void post();
	void run();
};

#endif